package com.alibaba.shopping_search_service.listener;

import com.alibaba.shopping_common.service.SearchService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName DelGoodsListener
 * @Description 删除商品数据的监听器
 * @Author Leo
 * @Date 2024/12/16 08:15
 */
@Service
@RocketMQMessageListener(topic = "del_goods_queue",consumerGroup = "del_goods_group")
public class DelGoodsListener implements RocketMQListener<Long> {

    @Autowired
    private SearchService searchService;

    @Override
    public void onMessage(Long id) {
        System.out.println("接收到删除商品消息，开始从ES中删除数据");
        searchService.delete(id);
    }
}




